using System;
using System.Xml;
using System.Xml.Serialization;
using System.Collections.Generic;

using Dashboard.Util;

namespace Dashboard
{
	public class Match
	{
		private Uri uri = null;
		private DateTime timestamp;
		private string type = null;
		private string trigger = null;
		private double relevancy = 0;
		private string relationship = null;
		
		private PropertyList properties = new PropertyList ();

		public Match ()
		{
		}

		public Match (string type)
		{
			this.type = type;
		}

		[XmlIgnore]
		public Uri Uri {
			get { return uri; }
			set { uri = value; }
		}

		[XmlAttribute ("Uri")]
		public string UriAsString 
		{
			get { return uri == null ? String.Empty : UriFu.UriToSerializableString (uri); }
			set { uri = UriFu.UriStringToUri (value); }
		}

		[XmlAttribute]
		public DateTime Timestamp
		{
			get { return timestamp; }
			set { timestamp = value; }
		}

		[XmlAttribute]
		public string Type {
			get { return type; }
			set { type = value; }
		}

		[XmlAttribute]
		public double Relevancy {
			get { return relevancy; }
			set { relevancy = value; }
		}

		[XmlAttribute]
		public string Trigger
		{
			get { return trigger; }
			set { trigger = value; }
		}

		[XmlAttribute]
		public string Relationship
		{
			get { return relationship; }
			set { relationship = value; }
		}

		public PropertyList Properties
		{
			get { return properties; }
			set { properties = value; }
		}
	}
}